<template name="zLocationCreate">
	<view class="center-view">
		<view class="option-item">
			<text class="item-name">问题</text>
			<input class="item-content theme-input" style="width:70%" v-model="que"/>
		</view>
		<view class="option-item">
			<text class="item-name">地区精度</text>
			<picker class="item-content" @change="changePrecision" :value="index" :range="precisions">
                <view style="fontSize:40upx;margin-right:10upx;">{{precisions[index]}}</view>
            </picker>
		</view>
	</view>
</template>
<script>
	export default {
		name : "zLocationCreate",
		data() {
			return {
				que : "",
				index : 2,
				// precisions : [{"name":"省","value":0},{"name":"市","value":1},{"name":"区县","value":2}]
				precisions : ["省","市","区县"]
			};
		},
		props : {
		},
		created : function(e){
			
		},
		methods: {
			get : function(id){
				if(this.que == ''){
					uni.showModal({
						title : '错误',
						content : '问题不可为空',
						showCancel : false
					})
					return null;
				}
				var res = {}
				res['question'] = this.que;
				res['key'] = 'q' + id;
				res['type'] = 'zlocation';
				var answer = {};
				answer['precision'] = this.index;
				res['answer'] = answer;
				// res['empty'] = answer;
				this.que = '';
				return res;
			},
			changePrecision : function(e){
				this.index = e.target.value;
			},
		}
	}
</script>

<style>
	@import "../../../common/zcss.css";
	@import "./creator.css";
</style>
